<%@ page import="java.util.*,blog.entities.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>EL表达式</title>
</head>
<body>
	<%
		request.setAttribute("name", "孙悟空");
		User user = new User();
		user.setId(1001);
		user.setUsername("swk");
		request.setAttribute("user", user);
		
		User user2 = new User();
		user2.setUsername("swk2");
		user2.setId(1002);
		request.setAttribute("user2", user2);
		
		//Map
		Map<String,User> map = new HashMap<>();
		map.put(user.getId() + "",user);
		map.put(user2.getId() + "",user2);
		request.setAttribute("uMap", map);
		
		// 数组
		User[] users = new User[2];
		users[0] = user;
		users[1] = user2;
		session.setAttribute("users", users);
		
		// 
		List<User> userList = new ArrayList<>();
		userList.add(user);
		userList.add(user2);
		session.setAttribute("userList", userList);
		
	%>
	
	
	${user.username } <br>
	${user.id } <br>
	
	<h1>取uMap数据</h1>
	<%=((Map<String,User>)request.getAttribute("uMap")).get("1001").getUsername() %> <br>
	${uMap["1001"].username} <br>
	${uMap["1002"].username} <br>
	<h1>取数组中的数据</h1>
	${users[0].username } <br>
	${users[0].id } <br>
	${users[1].username } <br>
	${users[1].id } <br>
	
	<h2>取List中的数据</h2>
	${userList[0].id }<br>
	${userList[0].username }<br>
	${userList[1].id }<br>
	${userList[1].username }<br>
	
	<h3>内置对象</h3>
	 ${param.age }
	<!-- 运算符 -->
	<h2>运算符</h2>
	<h6>empty not empty</h6>
	${empty lsit } <br>
	${not empty lsit } <br>
	<h6>gt lt</h6>
	${1 gt 2 } <br>
	${2 lt 1 } <br>
	<h6>eq</h6>
	${2 eq 2 }<br>
	${2 eq 1} <br>
	<h6>ne</h6>
	${2 ne 1} <br>
	${2 ne 2} <br>
	<h5>or</h5>
	${2 ne 1 or 2 ne 2 } <br>
	${2 ne 2 or 2 ne 1 } <br>
	${2 ne 2 or 3 ne 3 } <br>
	<h5>and</h5>
	${2 ne 1 and 2 ne 2 } <br>
	${2 ne 1 and 3 ne 2 } <br>
	<h3>pageContext</h3>
	${pageContext.request.contextPath }
</body>
</html>